$(document).ready( function () {

    // 展现检测结果
    warnCk = function (group,flag) {
        console.log("warnCK " + flag);
        if(flag==true) {
            console.log("bianlv");
            $(group).addClass("has-success") , $(group).removeClass("has-warning");
            $(".help-block")[0].style.display = 'none';
        } else {
            $(group).addClass("has-warning") , $(group).removeClass("has-success");
            $(".help-block")[0].style.display = 'inline';
        }
    }
    $("form #userName").blur( function (){
        console.log("账号检测函数被调用")
        $.ajax({
            url: "../servletDemo3",
            data: {
                action: "userExactCheck",
                userNum: $("form #userName").val(),
                userPwd: $("form #userPwd").val()
            },
            type: "POST",
            success: function (msg) {
                // alert(msg);
                console.log(msg);
                if(msg==false){
                    warnCk(".form-group1",false);
                } else {
                    warnCk(".form-group1",true);
                }

            },
            dataType: "json"
        });
    });
});